package ru.st.selenium.applogic;

import ru.st.selenium.model.Film;
import ru.st.selenium.model.Iternal;
import ru.st.selenium.model.FilmPage;
public class FilmHelper extends DriverBasedHelper {

  public FilmHelper(ApplicationManager manager) {
    super(manager.getWebDriver());
  }
  
  public void create(Film film) throws Exception {
	  pages.newFilmPage.clickAddFilmButton();
	  pages.newFilmPage.ensurePageLoaded().setIMDbField(film.getImdb())
	      .setTitleField(film.getTitle())
	      .setYearField(film.getYear())
	      .clickSubmitButton();
  }


public void delete(FilmPage filmpage) {
	pages.filmPage.clickNoCover();
	pages.filmPage.ensurePageLoaded().deleteFilm();

  }

  public void search(Iternal iternal) {
	  pages.internalPage.ensurePageLoaded()
	  .setSearchElement(iternal.getElement())
	  .FindResult(iternal.getText(), iternal.getElementText());
  }

}
